import request from '../utils/request'

// 获取文章列表
export const getArticles = (params) => {
    return request({
        url: '/v1_0/mp/articles',
        params
    })
}

// 删除文章
export const delArticles = (id) => {
    return request({
        url: `/v1_0/mp/articles/${id}`,
        method: 'DELETE'
    })
}

// 发布文章
export const addArticles = ({ draft = false, ...body }) => {
    return request({
        url: `/v1_0/mp/articles?draft=${draft}`,
        method: 'post',
        data: body
    })
}

// 编辑文章
export const ediArticles = ({ target, draft = false, ...body }) => {
    return request({
        url: `/v1_0/mp/articles/${target}?draft=${draft}`,
        method: 'put',
        data: body
    })
}

// 获取文章详情
export const getArticlesInfo = (id) => {
    return request({
        url: `/v1_0/mp/articles/${id}`,
    })
}